feat(calibration): backfill the corpus from historical review_targets decisions#8169
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8169 +/- ##
=======================================
Coverage 92.06% 92.06%
=======================================
Files 768 768
Lines 77838 77838
Branches 23516 23517 +1
=======================================
Hits 71663 71663
Misses 5062 5062
Partials 1113 1113
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-23 08:24:30 UTC
Review summary Nits — 5 non-blocking
Why this is blocked
📋 Copy for AI agents — paste into your coding agentCI checks failing
Decision drivers
Context & advisory signals — never blocks the verdict
Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
Good catch by the review on the |
df5ce39 to
c5c5f94
Compare
… decisions (#8157 phase 1) The calibration corpus only accumulated from the #8101 capture writers' ship date, while review_targets held 3,233 historical decisions. The pure core synthesizes the fired/override pairs those writers would have produced: close-verdict decisions with decision-level confidence, labeled by terminal outcome (closed = confirmed; a close-verdict PR that ended merged = reversed), mapped per #8157's ratified option (a) onto ai_consensus_defect — one rule id, never duplicated across siblings — with backfilled+provenance tags on every row so consumers can include or exclude the era explicitly. Never fabricates: non-close verdicts, missing confidence, and non-terminal rows are counted and skipped; modelResponseText is never synthesized. Idempotent by construction (deterministic ids + INSERT OR IGNORE, chunked statements). Applied to production after the dry-run report on the issue: 460 eligible decisions -> 920 rows; verified round-tripping through backtest-corpus-export into 460 labeled BacktestCases. 100% line+branch coverage on the core, including a buildBacktestCorpus round-trip test. Advances #8157.
…lently dropping a changed terminal decision ORB-review finding on the original INSERT OR IGNORE shape: with targetKey-only deterministic ids, a target whose terminal decision changed between two backfill runs had its second run's row silently dropped. ON CONFLICT(id) DO UPDATE on the decision-bearing columns makes cross-run semantics match the transform's own latest-terminal-wins dedupe; identical re-runs remain effective no-ops, and ids/provenance are unchanged.
c5c5f94 to
fc2b53b
Compare
Summary
signal.rule_fired/signal.human_overridepairs the calibration: wire linked_issue_scope_mismatch into the shared signal-tracking module (fired + reversal) #8101 capture writers would have produced from historicalreview_targetsdecisions — close verdicts with decision-level confidence, labeled by terminal outcome, mapped per the ratified option (a) ontoai_consensus_defect(one rule id, never duplicated), every row taggedbackfilled: true+ provenance.modelResponseTextnever synthesized), idempotent by construction (deterministic ids + chunkedINSERT OR IGNORE; re-runs and partial-apply overlaps are no-ops), latest-terminal-decision-wins dedupe, and both SQLite/ISO timestamp eras normalized. AbuildBacktestCorpusround-trip test proves synthesized rows become real labeledBacktestCases.backtest-corpus-exportround-tripping 460 labeled cases (checksumbd92485cea22…). The threshold backtest and the calibration trend now start from real history instead of an empty corpus.Advances #8157 (phase 2 — GitHub-truth reversal labels + raw-context re-fetch — is being split to its own issue; #8157 closes once this merges).
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Closes #123) — a linked open issue is required for every contributor PR.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally;codecov/patchrequires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:testnpm run ui:buildnpm audit --audit-level=moderateIf any required check was skipped, explain why:
npm run test:ciran green through the whole suite (1108 test files, 0 failures); itsui:version-auditfailure was purely the branch's stale fork point, resolved by rebasing onto current main (audit re-ran green, plus typecheck + the new suite). The diff is three standalonescripts/**+test/unit/**files — outside coverage.include per the established scripts exemption, with 100% line AND branch coverage on the pure core anyway (10 tests).Safety
UI Evidencesection below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.Backfilled rows carry only what the ledger already held (verdict, confidence, timestamps) plus tags — no raw content of any kind is synthesized or copied.
UI Evidence
Not applicable — no UI change.
Notes
DELETE FROM audit_events WHERE json_extract(metadata_json,'$.backfilled')removes the era cleanly if ever needed.